<div class="tyContent">
	<div class="box">
		<div class="box-body">
			<div class="toolbar">
				<button type="button" class="btn btn-primary" onclick="page.addUser()">
					<i class="fa fa-plus"></i> 新增
				</button>
			</div>

			<table data-ty-pageinit="bootstrapTable" data-url="data/sys/user/userList.json" data-toolbar=".toolbar">
				<thead>
					<tr>
						<th data-field="tsId" data-width="30%">用户id</th>
						<th data-field="tsName" data-width="20%">用户名</th>
						<th data-field="tsGroupCode" data-width="20%">所在用户组</th>
						<th data-formatter="page.options" data-events="page.events">操作</th>
					</tr>
				</thead>
				<tbody></tbody>
			</table>

			<div id="addDia" style="margin: 10px 5px;display: none">
				<table class="ty-table-form">
					<tr>
						<td width="20%">用户名</td>
						<td><input type="text" name="tsUserName" class="form-control" id="addUserTsUserName" placeholder="请输入用户名"></td>
					</tr>
					<tr>
						<td>用户组</td>
						<td><select data-ty-pageinit="select2" style="width: 100%;height: 34px" id="addUserTsGroup"></select></td>
					</tr>
					<tr>
						<td>昵称</td>
						<td><input type="text" name="tsName" class="form-control" id="addUserTsName" placeholder="请输入昵称"></td>
					</tr>
					<tr>
						<td>密码</td>
						<td><input type="text" name="tsPassword" class="form-control" id="addUserTsPassword" placeholder="请输入密码"></td>
					</tr>
					<tr>
						<td>确认密码</td>
						<td><input type="text" name="tsPassword2" class="form-control" id="addUserTsPassword2" placeholder="请再次输入密码"></td>
					</tr>
				</table>
			</div>
		</div><!-- /.box-body -->
	</div><!-- /.box -->
</div>

<script>
	app.pageInit({title:"用户列表2"});
	page.options = function() {
		return [
			'<a class="edit" href="javascript:void(0)" title="编辑" style="margin-left: 5px">',
			'<i class="fa fa-edit"></i>编辑',
			'</a>',
			'<a class="delete" href="javascript:void(0)" title="删除" style="margin-left: 5px">',
			'<i class="fa fa-remove"></i>删除',
			'</a>'
		].join('');
	};
	page.addUser = function() {
		$.get("data/sys/userGroup/nameAndIdList.json",null,function(d){
			$("#addUserTsGroup").select2({data:d});
		},"json");
		app.dialog($('#addDia'),function(){
			app.msg("新增了用户");
		},"添加用户",'600px');
	};
	page.events = {
        'click .edit': function (e, value, row, index) {
                alert(row.tsId);
         },
        'click .delete': function (e, value, r, index) {
			app.confirm('确定删除用户'+r.tsName+'吗？', function(){

				app.msg("删除了用户"+r.tsName);
			});
		},
      'click .tyb3': function (e, value, row, index) {
		  //alert(value);
	    }
     }
</script>